/**
 * Copyright (c) Huawei Technologies Co., Ltd. 2022. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <assert.h>
#include "../uapi/virtio_qtbox_sandbox.h"

#define QTBOX_DEV	"/dev/qtbox_service0" /* use first dev */

int main(int argc, char **argv)
{
	struct vqtbox_sandbox_vm_cap cap;
	int dev_fd = -1;
	long ret;

	dev_fd = open(QTBOX_DEV, O_RDWR | O_CLOEXEC);
	assert(dev_fd > 0);

	ret = ioctl(dev_fd, VQTBOX_SANDBOX_GET_CAP, &cap);
	assert(ret == 0);

	printf("Max supported instances: %lld\n", cap.max_instances);

	close(dev_fd);

	return 0;
}
